/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.uff.pgci.sgca.gateway.command;

import br.uff.pgci.sgca.gateway.model.Mensagem;
import java.net.InetSocketAddress;
import java.nio.channels.DatagramChannel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
import org.jboss.netty.channel.WriteCompletionEvent;

/**
 *
 */
public class ComandoRecuperarISO extends SimpleChannelUpstreamHandler {

    public static Integer ID_2_RECUPERAR_ISO = 2;

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        System.out.println("Recuperando ISO de cartao...");

        Mensagem msg = (Mensagem) e.getMessage();

        System.out.println("Recuperando ISO de "+ msg.getParametro() +" para o equipamento:" + msg.getIdEquipamento());

        ctx.getChannel().write("OK222", e.getRemoteAddress());
    }

}
